package com.ny.demo516;

public class Emp {

    private String number;
    private String name;
    private int age;
    // 构造方法：赋值：构造方法是方法名类名是一样的，没有返回值


    //有参数的构造方法
    public Emp(String number, String name, int age) {
        this.number = number;
        this.name = name;
        this.age = age;
    }
//无参数的构造方法
    public Emp(){

    }

    // set:赋值 get:获取
    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
    //toString 方法：输入所有的成员属性的值,直接输出对象名

    @Override
    public String toString() {
        return "Emp{" +
                "number='" + number + '\'' +
                ", name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
